package com.lai.shop.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * @BelongsPackage: com.lai.shop.config
 * @Author: laiciqi
 * @CreateTime: 2022-05-26  11:30
 * @Description: 线程池配置
 * @Version: 1.0
 */
@Configuration
public class ThreadConfig {


    @Bean
    public ThreadPoolExecutor threadPoolExecutor(){
        return new ThreadPoolExecutor(50, 200, 10,
                TimeUnit.SECONDS,
                new LinkedBlockingDeque<>(100000),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()
        );
    }
}
